package org.example.curriculum_design_6_16.entity.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.example.curriculum_design_6_16.entity.pojo.Grade;
import org.example.curriculum_design_6_16.entity.pojo.User;

import java.io.Serializable;

/**
 * 成绩视图对象
 */
@ApiModel(description = "成绩视图对象")
@Data
public class GradeVo implements Serializable {

    @ApiModelProperty(value = "成绩ID")
    private Integer id;

    @ApiModelProperty(value = "学生ID", required = true)
    private String studentId;

    @ApiModelProperty(value = "学生姓名")
    private String studentName;

    @ApiModelProperty(value = "课程ID", required = true)
    private String courseId;

    @ApiModelProperty(value = "课程名称")
    private String courseName;

    @ApiModelProperty(value = "成绩分数", required = true)
    private Double score;

    @ApiModelProperty(value = "学期", required = true)
    private String semester;

    public void buildGradeVo(Grade grade, String courseName) {
        this.studentId = grade.getStudentId();
        this.courseId = courseId;
        this.courseName = courseName;
        this.score = grade.getScore();
        this.semester = grade.getSemester();
    }

    private static final long serialVersionUID = 1L;
}